Skip to content

Conversation

@Gedochao
Copy link
Contributor

as per #24247 (comment):

  • the usejavacp setting would now be Yusejavacp (a fork setting, rather than root)
  • old API (-usejavacp/--usejavacp/--use-java-class-path) would be preserved as aliases

@lrytz
Copy link
Member

lrytz commented Oct 30, 2025

Is it possible to have deprecated aliases?

@hamzaremmal
Copy link
Member

hamzaremmal commented Oct 30, 2025

I really believe we should completely remove it. I'm not convinced of any of the arguments I've heard so far...

@Gedochao
Copy link
Contributor Author

Is it possible to have deprecated aliases?

It's been discussed, but we never implemented deprecating aliases, unfortunately.

@Gedochao Gedochao force-pushed the maintainance/yusejavacp branch from b508e87 to 2165922 Compare October 30, 2025 10:55
@lrytz
Copy link
Member

lrytz commented Oct 30, 2025

I really believe we should completely remove it. I'm not convinced of any of the arguments I've heard so far...

It's extremely useful for unit tests that instantiate the compiler, in scala/scala there are lots of such uses. It would be cumbersome to manually assemble a symbol table classpath, we'd have to get information from the build tool to the test runtime.

Examples

@hamzaremmal
Copy link
Member

It would be cumbersome

It would be cumbersome but it would be the correct usage of the compiler. We do that in Scala3. Vulpix doesn't use the underlying classpath and reconstruct them manually. See:

def scala2Command(): Array[String] = {
assert(!flags.options.contains("-scalajs"),
"Compilation tests with Scala.js on Scala 2 are not supported.\nThis test can be skipped using the `// scalajs: --skip` tag")
val stdlibClasspath = artifactClasspath("org.scala-lang", "scala-library")
val scalacClasspath = artifactClasspath("org.scala-lang", "scala-compiler")
val flagsArgs = flags
.copy(options = Array.empty, defaultClassPath = stdlibClasspath)
.withClasspath(targetDir.getPath)
.and("-d", targetDir.getPath)
.all
val scalacCommand = Array("java", "-cp", scalacClasspath, "scala.tools.nsc.Main")
scalacCommand ++ flagsArgs ++ fileArgs

def scala3Command(): Array[String] = {
val stdlibClasspath = artifactClasspath("org.scala-lang", "scala3-library_3")
val scalacClasspath = artifactClasspath("org.scala-lang", "scala3-compiler_3")
val flagsArgs = flags
.copy(defaultClassPath = stdlibClasspath)
.withClasspath(targetDir.getPath)
.and("-d", targetDir.getPath)
.and("-pagewidth", pageWidth.toString)
.all
val scalacCommand = Array("java", "-cp", scalacClasspath, "dotty.tools.dotc.Main")
scalacCommand ++ flagsArgs ++ fileArgs

So if Scala 2 (years ago) did it for simplicity or whatever reason, I don't see it stand as a solid argument (Scala 3 took the time to have a correct testing suite).

@lrytz
Copy link
Member

lrytz commented Oct 30, 2025

It's a simple and reliable way to get a symbol classpath that's in sync with the library / compiler that we want to test, and we did it for 20 years without issues, one could see that as a solid argument in favor 😉

@hamzaremmal
Copy link
Member

hamzaremmal commented Oct 30, 2025

It's a simple and reliable way to get a symbol classpath that's in sync with the library / compiler that we want to test, and we did it for 20 years without issues, one could see that as a solid argument in favor 😉

I'm not saying it doesn't work. It does work to some extent. I'm saying it should have not existed in the first place and the underlying runtime is different from the compiler space. What if we are to compile the compiler with Scala.js and run it on the browser for scastie for example? How would this specific flag work and how it would be implemented when you don't have an underlying JVM?

@Gedochao
Copy link
Contributor Author

...that aside, any clue about the scaladoc CI failure? 🤔

@lrytz
Copy link
Member

lrytz commented Oct 30, 2025

I understand your points, it seems we don't come to the same conclusion. I agree it should be, should always have been, a -Y flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants